// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
//
// $Id: child_node.hpp 210 2008-08-28 10:10:41Z heavyzheng $
//

#ifndef ZZHENG_XML_DOM_LIBXML2_CHILD_NODE_HPP_20080726__
#define ZZHENG_XML_DOM_LIBXML2_CHILD_NODE_HPP_20080726__

#include <zzheng/xml/config.hpp>
#include <zzheng/xml/dom/basic_node_ptr.hpp>

#include <zzheng/xml/dom/libxml2/node.hpp>

namespace zzheng {
namespace xml {
namespace dom {
namespace libxml2_ {

    class child_node_list;

    //! This abstract base class represents an XML node that can be a child node under an element.
    class child_node: public node {

        friend class child_node_list;

    public:

        //! Pure virtual destructor.
        virtual ~child_node() = 0;

        //! Returns the previous sibling.
        //! \return the previous sibling.
        basic_node_ptr<child_node> prev_sibling();

        //! Returns the next sibling.
        //! \return the next sibling.
        basic_node_ptr<child_node> next_sibling();

        //! Const version of prev_sibling().
        basic_node_ptr<const child_node> prev_sibling() const;

        //! Const version of next_sibling().
        basic_node_ptr<const child_node> next_sibling() const;

    protected:

        //! Protected constructor.
        explicit child_node(xmlNode* px);

    private:

        const child_node* prev_sibling_() const;

        const child_node* next_sibling_() const;

    }; // class child_node

} // namespace zzheng::xml::dom::libxml2_
} // namespace zzheng::xml::dom
} // namespace zzheng::xml
} // namespace zzheng

#endif // ZZHENG_XML_DOM_LIBXML2_CHILD_NODE_HPP_20080726__



